package com.wbc.smartHome.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.Date;

@Component
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "用户模型类")
public class User implements Serializable {
    /*开启缓存需要返回的model类实现序列化接口Serializable*/
    @ApiModelProperty(value = "用户id")
    private Integer id;
    @ApiModelProperty(value = "用户账号")
    private String account;
    @ApiModelProperty(value = "用户网名")
    private String name;//用户网名
    @ApiModelProperty(value = "用户token")
    private String userToken;
    @ApiModelProperty(value = "验证码")
    private String yzm;//
    @ApiModelProperty(value = "创建账号时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")//接收前端提交数据的日期格式
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")//后端向前端转json时的日期格式
    private Date operTime;//创建账号时间
    @ApiModelProperty(value = "头像照片地址")
    private String img;//头像照片地址
    @ApiModelProperty(value = "用户性别")
    private String gender;
    @ApiModelProperty(value = "用户电话")
    private String phone;
    @ApiModelProperty(value = "用户状态")
    private Integer state;//用户状态
    @ApiModelProperty(value = "用户生日")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")//接收前端提交数据的日期格式
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", timezone = "UTC")
    private Date birthday;//用户生日
    @ApiModelProperty(value = "用户家庭地址")
    private String address;//用户家庭地址
    //lombok组件 在编译期间动态生成get、set方法

}
